package com.chuangjiangx.member.basic.ddd.dal.dto;

import lombok.Getter;

import java.math.BigDecimal;

/**
 * 会员账户信息
 **/
@Getter
public class MemberAccount {

    /**
     * 当前积分
     */
    private Long availableScore;

    /**
     * 累计积分
     */
    private Long totalScore;

    /**
     * 已兑换积分
     */
    private Long totalConsumeScore;

    /**
     * 可用余额
     */
    private BigDecimal availableBalance;

    /**
     * 历史储值金额
     */
    private BigDecimal totalRechargeBalance;

    /**
     * 储值赠送金额
     */
    private BigDecimal totalGiveBalance;

    /**
     * 历史消耗金额
     */
    private BigDecimal totalConsumeBalance;

    public void setTotalConsumeScore(Long totalConsumeScore) {
        totalConsumeScore = totalScore - availableScore;
        this.totalConsumeScore = totalConsumeScore;
    }

    public void setAvailableScore(Long availableScore) {
        this.availableScore = availableScore;
    }

    public void setTotalScore(Long totalScore) {
        this.totalScore = totalScore;
    }

    public void setAvailableBalance(BigDecimal availableBalance) {
        this.availableBalance = availableBalance;
    }

    public void setTotalRechargeBalance(BigDecimal totalRechargeBalance) {
        this.totalRechargeBalance = totalRechargeBalance;
    }

    public void setTotalGiveBalance(BigDecimal totalGiveBalance) {
        this.totalGiveBalance = totalGiveBalance;
    }

    public void setTotalConsumeBalance(BigDecimal totalConsumeBalance) {
        totalConsumeBalance = totalRechargeBalance.add(totalGiveBalance).subtract(availableBalance);
        this.totalConsumeBalance = totalConsumeBalance;
    }

}
